/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.is.city.webcam;

import org.geotools.styling.ExternalGraphic;
import org.geotools.styling.FeatureTypeStyle;
import org.geotools.styling.Graphic;
import org.geotools.styling.PointSymbolizer;
import org.geotools.styling.Rule;
import org.geotools.styling.Style;
import org.geotools.styling.StyleBuilder;

/**
 *
 * @author oleg
 */
public class WebCamStyle {
    public static Style createStyle(){
        StyleBuilder styleBuilder = new StyleBuilder();
        Style style = styleBuilder.createStyle();

        PointSymbolizer pointSymbolizer = styleBuilder.createPointSymbolizer();

        Graphic graphic = styleBuilder.createGraphic();

        ExternalGraphic external = styleBuilder.createExternalGraphic(WebCamStyle.class.getResource("/webcamicon.png"),
                "image/png");
        graphic.graphicalSymbols().add(external);
        graphic.graphicalSymbols().add(styleBuilder.createMark("circle"));

        pointSymbolizer.setGraphic(graphic);

        Rule rule = styleBuilder.createRule(pointSymbolizer);
        FeatureTypeStyle featureTypeStyle = styleBuilder.createFeatureTypeStyle("Feature", rule);
        style.featureTypeStyles().add(featureTypeStyle);
        return style;
    }
}
